using System;
using System.Collections.Generic;
using System.Text;

namespace GatherTogether
{
    class MatchedPair<S, T>
    {
        Dictionary<S, T> m_dictionaryStoT = new Dictionary<S, T>();
        Dictionary<T, S> m_dictionaryTtoS = new Dictionary<T, S>();

        public void AddPair(S value1, T value2)
        {
            m_dictionaryStoT.Add(value1, value2);
            m_dictionaryTtoS.Add(value2, value1);
        }

        public bool GetSecond(S key, out T result)
        {
            return m_dictionaryStoT.TryGetValue(key, out result);
        }

        public bool GetFirst(T key, out S result)
        {
            return m_dictionaryTtoS.TryGetValue(key, out result);
        }
    }
}
